/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 * @lint-ignore-every XPLATJSCOPYRIGHT1
 */

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import { Image } from 'react-native';
import { NativeModules } from 'react-native';

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};
var rnToastAndroid = NativeModules.ToastByAndroid;
	rnToastAndroid.getPackageName();
		rnToastAndroid.getEthAccount().then((map)=> { 
  alert('地址：'+'\n'+map['address']+'\n'+'私钥'+map['privateKey']);}, (code, message)=> {
    alert(message);
});
	rnToastAndroid.getBtcAccount().then((map)=> { 
  alert('地址：'+'\n'+map['address']+'\n'+'私钥'+map['privateKey']);}, (code, message)=> {
    alert(message);
});
	rnToastAndroid.getTrxAccount().then((map)=> { 
  alert('地址：'+'\n'+map['address']+'\n'+'私钥'+map['privateKey']);}, (code, message)=> {
    alert(message);
});

var rnToastAndroid = NativeModules.ToastByAndroid;
	rnToastAndroid.getPackageName();
	var address;
	var privateKey;
	rnToastAndroid.getEthAccount().then((map)=> { 
	address = map['address'];
	privateKey = map['privateKey'];
  alert('地址：'+'\n'+map['address']+'\n'+'私钥'+map['privateKey']);}, (code, message)=> {
    alert(message);
});

class Greeting extends Component {
	
  render() {
  let pic = {
            uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'
          };
    return (
      <View style={{alignItems: 'center'}}>
        <Text> {this.props.name}!</Text>
		<Text>
		address
		privateKey
		</Text>
        <Image source={pic} style={{width: 230, height: 110}} />
      </View>
    );
  }
}

export default class LotsOfGreetings extends Component {
  render() {
    return (
      <View style={{alignItems: 'center'}}>
        <Greeting name='Rexxar' />
        <Greeting name='Jaina' />
        <Greeting name='Valeera' />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});
